<template>
	<view class="beijingse mainpadding">
		<view class="zwtimg flexcenter" v-if="!list.data.length">
			<image src="../../static/image/system/zwt.png" mode=""></image>
		</view>
		<view class="shangjianj mainpadding ffffff radius" v-if="list.data.length" v-for="item in list.data" :key="item.id"  @click="tzxiangq(item.id)">
			<view class="flexbetween">
				<view class="shilitu">
					<image :src="item.image_text" mode=""></image>
				</view>
				<view class="" style="width: 72%;">
					<view class="ershib">{{item.title}}</view>
					<view class="margin_top1 xiankuan ershil">{{item.des}}</view>
				</view>
			</view>
			<view class="margin_top flexbetween">
				<view class="fensbtn">年化率{{item.rate}}%</view>
				<view class="huangbtn">查看详情</view>
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				page: 1,
				limit: 12,
				list:{
					data:[]
				}
			}
		},
		onShow() {
			this.init()
		},
		methods: {
			init(isPage, page) {
				let _this = this;
				httpRequest.request('/api/styc/stycList', 'POST', {
					page: page || 1,
					limit: _this.limit,
				}, false, false, true).then(res => {
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = res.data
							_this.list.data = resList.data;
						}
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
			// 跳转详情
			tzxiangq(id) {
				uni.navigateTo({
					url: '/pages/homepage/xiangmuxq?id='+id
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.huangbtn {
		width: 170rpx;
		height: 56rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 120rpx;
		background-color: #FFC059;
		font-size: 26rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #FFFFFF;
	}

	.fensbtn {
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #FF0000;
		display: flex;
		align-items: center;
		justify-content: center;
		width: 187rpx;
		height: 52rpx;
		background: rgba(255, 0, 0, .1);
		border-radius: 6rpx;
	}

	.ershib {
		font-size: 28rpx;
		font-family: PingFang SC-Heavy, PingFang SC;
		font-weight: 800;
		color: #000000;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.shangjianj {
		margin-top: 30rpx;
	}

	.shangjianj:first-child {
		margin-top: 0rpx;
	}

	.shilitu {
		width: 134rpx;
		height: 128rpx;
		border-radius: 14rpx;

		image {
			width: 100%;
			height: 100%;
			border-radius: 14rpx;
		}
	}
</style>
